#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

// set NOISY_TEST to 0 to remove printfs from output
#define NOISY_TEST 1


int main() {
    int seed = 1000;
    int numPlayer = 2;
    int r;//, i;
    int k[10] = {adventurer, council_room, feast, gardens, mine
               , remodel, smithy, village, baron, great_hall};
    struct gameState G;
	int loopCnt = 10; //how many loops I want to test this over and over
	int theResult, i;
	int handPos = 4;
	int card = village; 
	int choice1 = 0;
	int choice2 = 0;
	int choice3 = 0;
	int bonus = 0;
	int numCards;
	
	#if (NOISY_TEST == 1)
		printf ("TESTING cardEffect, specifically village() which is #8:\n");
	#endif

	for(i=0; i<loopCnt; i++) {
		
		memset(&G, 23, sizeof(struct gameState));   // clear the game state
		r = initializeGame(numPlayer, k, seed, &G); // initialize a new game

		theResult = cardEffect(card, choice1, choice2, choice3, &G, handPos, &bonus);//the number of the switch to use
		numCards = *G.handCount;

		#if (NOISY_TEST == 1)
			printf("number of cards = %d, expected = %d\n", numCards, 5); //should add 1 to cards. Already have 4 in hand at start
		#endif
			
		assert(numCards == 5); // check if the number of cards is correct
						
		#if (NOISY_TEST == 1)
			printf("number of actions = %d, expected = %d\n", G.numActions, 3); //should add 2 to actions. Already have 1.
		#endif
			
		assert(G.numActions == 3); // check if the number of actions is correct					
	}	
	
	printf("All tests passed!\n");

    return 0;
}
